package com.wtkl.servlet;

import com.wtkl.pojo.leave;
import com.wtkl.pojo.selectStudent;
import com.wtkl.pojo.user;
import com.wtkl.service.dormitoryService;
import com.wtkl.service.impl.dormitoryServiceImpl;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@WebServlet("/login")
public class dormitoryServlet extends baseServlet{


      private dormitoryService dormitoryService =new dormitoryServiceImpl();
        /**
         *功能：登录
         *参数：
         *account 账号
         *password 密码
         *role 身份
         * 返回值：List<user>id或name
         */
        public void login(HttpServletRequest req, HttpServletResponse resp){

            String password = req.getParameter("password");
            String account = req.getParameter("account");
            String identity = req.getParameter("identity");

            Integer integer = new Integer(identity);

            Integer login = dormitoryService.login(password,account,integer);

            System.out.println(login);
        }




        /**
         *负责人：背带裤
         *功能：查询学生基本信息
         *
         *参数：id
         * 返回值：student_name,dormitory_build,dormitoryAdmin,telephone,absence_time,  user对象
         *
         */
        public void stuSelectInformation(HttpServletRequest req, HttpServletResponse resp)
        {
            String id = req.getParameter("id");
            List<selectStudent> users = dormitoryService.stuSelectInformation(id);

        }


    /**
     *负责人：背带裤
     *功能：学生请假管理,查，增
     *
     *
     *参数：
     * 返回值：
     */

    //查 返回
    public void stuSelectLeave(HttpServletRequest req, HttpServletResponse resp){
        String id = req.getParameter("id");
        List<leave> leaves = dormitoryService.stuSelectLeave(id);


    }
    //增 返回值0失败，1成功
    public void stuSubLeave(HttpServletRequest req, HttpServletResponse resp)
    {
        //要将获取的数值转化为一个leave对象
        return ;
    }




    /**
     *负责人：背带裤
     *功能：学生通知查询,查
     *
     *参数：
     * 返回值：
     */
    public void stuSelectNotice(HttpServletRequest req, HttpServletResponse resp)
    {

    }

}



